﻿using System.Windows.Controls;
using KinonekoSoftware.Studio.Models.Graphs;

namespace KinonekoSoftware.Studio.Pages.Galleries.Abilities
{

    [Associate(View = typeof(AbilityGalleryView), ViewModel = typeof(AbilityGalleryViewModel))]
    public partial class AbilityGalleryView
    {
        public AbilityGalleryView()
        {
            InitializeComponent();
        }
        
        private void OnDataSourceDoubleClick(object sender, MouseButtonEventArgs e)
        {
        }
        
        
        private void DisplayMode_Circle(object sender, RoutedEventArgs e)
        {
            var menu         = sender as MenuItem;

            if (menu?.Tag is not AbilityUsageGraphLayout layout)
            {
                return;
            }
            
            layout.LayoutAlgorithmType = "Circular";
        }

        private void DisplayMode_ISOM(object sender, RoutedEventArgs e)
        {
            var menu = sender as MenuItem;

            if (menu?.Tag is not AbilityUsageGraphLayout layout)
            {
                return;
            }
            layout.LayoutAlgorithmType = "ISOM";
        }
        
        private void DisplayMode_LinLog(object sender, RoutedEventArgs e)
        {
            var menu = sender as MenuItem;

            if (menu?.Tag is not AbilityUsageGraphLayout layout)
            {
                return;
            }
            layout.LayoutAlgorithmType = "LinLog";
        }
        
        private void DisplayMode_KK(object sender, RoutedEventArgs e)
        {
            var menu = sender as MenuItem;

            if (menu?.Tag is not AbilityUsageGraphLayout layout)
            {
                return;
            }
            
            layout.LayoutAlgorithmType = "KK";
        }
    }
}